package com.illtamer.infinite.collapsar.dispatcher.builder;

import java.util.function.Consumer;

public class BaseSingleBuilder<Entity, Parent> {

    protected final Entity entity;

    protected final Parent instance;

    protected BaseSingleBuilder(Entity entity, Parent instance) {
        this.entity = entity;
        this.instance = instance;
    }

    /**
     * Custom operation method.
     * */
    public BaseSingleBuilder<Entity, Parent> custom(Consumer<Entity> consumer) {
        consumer.accept(entity);
        return this;
    }

    /**
     * Continue building the parent builder.
     * */
    public Parent done() {
        return instance;
    }

}
